Crate persist_if_changed
source ·Expand description
A tiny utility library to avoid touching the filesystem if the content has not changed.
This is useful to avoid triggering unnecessary rebuilds in systems that look at
the modification time (mtime
) as part of their file fingerprint (e.g. cargo
).
Functions§
- Only copy the file if its contents differ from the contents stored at the destination path.
- Returns
true
if the file contents are different,false
otherwise. - Returns
true
if the file contents are different,false
otherwise. - Only persist the content if it differs from the one already on disk. It if the file does not exist, it will be created.